/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aburakc.message;

import aburakc.network.MessageProcessor;
import java.util.Date;

/**
 *
 * @author burak.costu
 */
public class SMSTextMessage extends GeneralMessage{

    private String message;
    private String address;
    private Date date;

    /**
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * @param message the message to set
     */
    public void setMessage(String message) {
        this.message = message;
    }

    /**
     * @return the address
     */
    public String getAddress() {
        return address;
    }

    /**
     * @param address the address to set
     */
    public void setAddress(String from) {
        this.address = from;
    }

    /**
     * @return the date
     */
    public Date getDate() {
        return date;
    }

    /**
     * @param date the date to set
     */
    public void setDate(Date date) {
        this.date = date;
    }

    public String toNetworkMessage() {
        StringBuffer sb = new StringBuffer();
        sb.append(SMS);
        sb.append(SEPERATOR);
        sb.append(getMessageId());
        sb.append(SEPERATOR);
        sb.append(getAddress());
        sb.append(SEPERATOR);
        sb.append(getDate().getTime());
        sb.append(SEPERATOR);
        sb.append(getMessage());
        sb.append(FINAL_SEPERATOR);
        return sb.toString();
    }


    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append(getAddress());
        sb.append("\n");
        sb.append(getMessage());
        sb.append("\n");
        sb.append(getDate().getTime());
        return sb.toString();
    }


}
